import Vue from 'vue'
import VueRouter from 'vue-router'
import { union } from 'util/lib/remex'
Vue.use(VueRouter)

// 客户、管理端路由注入
import clientCfg from './router_client'
import managerCfg from './router_manager'

//共用父页面
const proxy = resolve => require(['../views/general/proxy'], resolve)
const notFound = resolve => require(['../views/general/404'], resolve)

let routes = [
  {path: '/proxy',name:'proxy',component:proxy},
  {path: '/notFound',name:'notFound',component:notFound}
]

routes = new Set([...routes, ...managerCfg, ...clientCfg])

// const scrollBehavior = (to, from, savedPosition) => {
//   if (savedPosition) {
//     return savedPosition
//   } else {
//     const position = {}
//     console.log(to.hash);
//     if (to.hash) {
//       position.selector = to.hash
//     }
//     if (to.matched.some(m => m.meta.scrollToTop)) {
//       position.x = 0
//       position.y = 0
//     }
//     return position
//   }
// }

export default new VueRouter({
  // mode: 'history',
  // scrollBehavior,
  routes,

});

